<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>BFC</title>
  </head>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    .father {
      background-color: pink;
    }
    .son {
      width: 200px;
      height: 200px;
      background-color: skyblue;
    }
    /* .father {
      overflow: hidden;
    } */
    .son {
      float: right;
    }
    .clearfix::after {
      content: "";
      display: block;
      clear: both;
    }
  </style>
  <body>
    <div class="father clearfix">
      <div class="son">子元素</div>
      <!-- ::after -->
    </div>
  </body>
</html>
